package com.zhcd.sys.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zhcd.sys.pojo.Catalog;
import com.zhcd.sys.mapper.CatalogMapper;
import com.zhcd.sys.pojo.Mattess;
import com.zhcd.sys.service.CatalogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author feifei
 * @since 2021-11-29
 */
@Service
public class CatalogServiceImpl extends ServiceImpl<CatalogMapper, Catalog> implements CatalogService {
    @Autowired
    private CatalogMapper catalogMapper;

    //查询所有菜单
    public List<Catalog> getAll_Catalog(){
        return catalogMapper.selectList(null);
    };

    //按条件(有无上级)查找菜单
    @Override
    public List<Catalog> getAll_UpNavCatalog(int UpNav) {
        QueryWrapper<Catalog> objectQueryWrapper = new QueryWrapper<>();
        objectQueryWrapper.eq("UpNav",UpNav);
        return catalogMapper.selectList(objectQueryWrapper);
    }
}
